package com.vegetable.modules.service.wx;

import com.baomidou.mybatisplus.extension.service.IService;
import com.vegetable.modules.entity.wx.WXApproval;
import com.vegetable.modules.entity.wx.po.QueryWXApprovalPO;
import com.vegetable.modules.entity.wx.po.UpdatePaymentStatusPO;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.bean.oa.WxCpApprovalDetailResult;

import java.util.List;
import java.util.Map;

public interface WXApprovalService extends IService<WXApproval> {
    /**
     * 从微信导入
     */
    void importFromWX() throws Exception;

    WXApproval getWxApproval(WxCpApprovalDetailResult detail) throws WxErrorException;

    /**
     * 转换微信id
     * @throws Exception
     */
    void convertToUserId() throws Exception;

    /**
     * 提交审批
     */
    void applyApproval() throws Exception;

    /**
     * 获取审批模板详情
     */
    void getApprovalTemplateDetail() throws WxErrorException;

    /**
     * 测试提交审批
     */
    void testSubmitApproval() throws Exception;

    void listId() throws Exception;

    void getUserInfo() throws Exception;

    List<WXApproval> selectBySPNOList(List<String> spNOList);

    WXApproval selectBySPNO(String spNO);

    Map<String, Object> selectList(QueryWXApprovalPO po);

    WxCpApprovalDetailResult getReleaseApprovalDetail(String spNo) throws WxErrorException;

    /**
     * 更新付款状态
     * @param po 更新付款状态参数
     * @return 是否更新成功
     */
    boolean updatePaymentStatus(UpdatePaymentStatusPO po);
    
    /**
     * 同步审批状态到企业微信
     * @param spNo 审批编号
     * @param status 状态 (ALREADY_PAY 已支付)
     * @return 是否同步成功
     */
    boolean syncApprovalStatusToWechat(String spNo, String status);
}